﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Exercise14
{
    internal class NumberFun
    {
        User User;
        public string Result;        
        public User GetResult(string Instr) 
        {
            User = new User(false, "Pass");
            int OutNum;
            if (string.IsNullOrEmpty(Instr))      { User.bIsNull = true; User.StrMsg = "Is null";             return User; }
            if (!int.TryParse(Instr, out OutNum)) { User.bIsNull = true; User.StrMsg = "Is not a number";     return User; }
            if (OutNum > 10 || OutNum < 0)        { User.bIsNull = true; User.StrMsg = "No between 0 and 10"; return User; }
            Result = string.Format("{0:D3}", (int)Math.Pow(OutNum, 3));
            return User;
        }

    }
}
